package com.lu.library.ext

import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
import com.blankj.utilcode.util.LogUtils
import com.lu.library.listener.EndlessRecyclerViewScrollListener

fun RecyclerView.addOnLoadMore(onLoadMore: () -> Unit){

    if (layoutManager is LinearLayoutManager){
        var listener = EndlessRecyclerViewScrollListener(layoutManager as LinearLayoutManager,onLoadMore)
        addOnScrollListener(listener);
        return
    }
    LogUtils.d("${layoutManager} is not LinearLayoutManager")
}